#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "Realization.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Classifier;
class Component;

/// <summary>
/// ComponentRealization
/// Realization is specialized to (optionally) define the Classifiers that realize
/// the contract offered by a Component in terms of its provided and required
/// Interfaces. The Component forms an abstraction from these various Classifiers.
/// </summary>
class UMLMODEL_EXPORT ComponentRealization : public Realization {

public: // Constructors and destructors
    explicit ComponentRealization(const QString& umlType="uml::ComponentRealization");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// abstraction getter
    /// The Component that owns this ComponentRealization and which is implemented by
    /// its realizing Classifiers.
    /// </summary>
    shared_ptr<Component> abstraction() const;

    /// <summary>
    /// abstraction setter
    /// The Component that owns this ComponentRealization and which is implemented by
    /// its realizing Classifiers.
    /// </summary>
    void setAbstraction(shared_ptr<Component> value);

    /// <summary>
    /// realizingClassifiers getter
    /// The Classifiers that are involved in the implementation of the Component that
    /// owns this Realization.
    /// </summary>
    vector<shared_ptr<Classifier>>& realizingClassifiers();

private: // Fields
    /// <summary>
    /// abstraction
    /// The Component that owns this ComponentRealization and which is implemented by
    /// its realizing Classifiers.
    /// </summary>
    shared_ptr<Component> abstraction_;

    /// <summary>
    /// realizingClassifiers
    /// The Classifiers that are involved in the implementation of the Component that
    /// owns this Realization.
    /// </summary>
    vector<shared_ptr<Classifier>> realizingClassifiers_;

};

} // namespace uml
